function [ tree ] = Addintotree( vsegment,tree )
%ADDINTOTREE Summary of this function goes here
%   Detailed explanation goes here
    switch (vsegment.level)
        case 1,
        tree.element1.segments=[tree.element1.segments,vsegment];
        tree.element1.segments_num=tree.element1.segments_num+1;
        case 2,
        tree.element2.segments=[tree.element2.segments,vsegment];
        tree.element2.segments_num=tree.element2.segments_num+1;
        case 3,
        tree.element3.segments=[tree.element3.segments,vsegment];
        tree.element3.segments_num=tree.element3.segments_num+1;
        case 4,
        tree.element4.segments=[tree.element4.segments,vsegment];
        tree.element4.segments_num=tree.element4.segments_num+1;
        case 5,
        tree.element5.segments=[tree.element5.segments,vsegment];
        tree.element5.segments_num=tree.element5.segments_num+1;
        case 6,
        tree.element6.segments=[tree.element6.segments,vsegment];
        tree.element6.segments_num=tree.element6.segments_num+1;
        case 7,
        tree.element7.segments=[tree.element7.segments,vsegment];
        tree.element7.segments_num=tree.element7.segments_num+1;
    end

end

